package cn.com.api.mapper.base;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import cn.com.api.entity.ApiT_user_role_action;

//DAO
public interface T_user_role_actionMapperBase {

	// 根据id查看
	@Select("SELECT * FROM t_user_role_action  WHERE id = #{id}")
	public ApiT_user_role_action findT_user_role_actionById(Integer id);

	// 查看数据集
	@Select("SELECT * FROM T_user_role_action")
	public List<ApiT_user_role_action> findT_user_role_actions();

	// 添加
	@Insert("INSERT INTO t_user_role_action (role_id, action_id) VALUES (#{role_id}, #{action_id})")
	@Options(useGeneratedKeys = true, keyProperty = "id")
	public int insertT_user_role_action(ApiT_user_role_action t_user_role_action);

	// 修改
	@Update("UPDATE t_user_role_action SET role_id = #{role_id}, action_id = #{action_id} WHERE id = #{id}")
	public int updateT_user_role_action(ApiT_user_role_action t_user_role_action);

	// 删除
	@Delete("DELETE FROM t_user_role_action  WHERE id = #{id}")
	public int deleteT_user_role_action(Integer id);

	// Foreign keys revelant

	// 删除根据Role_id
	@Delete("DELETE FROM t_user_role_action  WHERE role_id = #{role_id}")
	public int T_user_role_actionDeleteByRole_id(String role_id);

	// 获取根据Role_id
	@Select("SELECT id, role_id, action_id FROM t_user_role_action  WHERE role_id = #{role_id}")
	public List<ApiT_user_role_action> findT_user_role_actionsByRole_id(String role_id);

	// 删除根据Action_id
	@Delete("DELETE FROM t_user_role_action  WHERE action_id = #{action_id}")
	public int T_user_role_actionDeleteByAction_id(String action_id);

	// 获取根据Action_id
	@Select("SELECT id, role_id, action_id FROM t_user_role_action  WHERE action_id = #{action_id}")
	public List<ApiT_user_role_action> findT_user_role_actionsByAction_id(String action_id);

	// region Indexs revelant

}
